<?php 
if($_GET['con']=='delete'&&$_POST['submit']!=''){
    for($i=0;$i<count($_POST['selectbox']);$i++)
    {
        $query = "delete from ".DBPREFIX."question where q_id=".$_POST['selectbox'][$i];
        $result = $db->query($query);
    }
    if($result){
        fs_showmsg('删除成功!','?do=qlist');
    }
    else{
        fs_showmsg('删除失败!');
    }
}
?>

<form action="?do=qlist&con=delete" method="post" onsubmit="return checkBoxSelect()">
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="CContent">
  <tr><td>
    <div class="submenu_t">
            <ul>
                <li><a href="?do=qlist">试题列表</a> | </li>
		<li><a href="?do=add_q">添加试题库</a> | </li>
		<li><a href="?do=addquestion">添加试题</a>|</li>
                <li><a href="">批量导入</a></li>
            </ul>
    </div>
    </td>
    </tr>
    <tr><td>
    
                    <table width="100%" border="0" cellpadding="0" cellspacing="0" class="question_list" id="tblist">
                            <thead>
                                    <tr><th></th><th>试题标题</th><th>试题难度</th><th>所属试题库</th><th>试题类型</th><th>分值</th><th>操作</th></tr>
                            </thead>
                            <tbody>
                                     <?php                           
                                            $query = "select a.*,b.* from ".DBPREFIX."tiku as a inner join ".DBPREFIX."question as b on a.t_id=q_tiku where b.q_createuid=".$teacher_id;
                                            $result = $db->query($query);
                                            while($row = $db->fetch_array($result))
                                            {
                                                $str_str='';
                                     ?>
                                    <tr>
                                            <td><input type="checkbox" name="selectbox[]" id="selectbox" value="<?php echo $row['q_id']; ?>" /></td>
                                            <td style="width:500px;word-wrap:break-word"><?php echo $row['q_title'] ?></td>
                                            <td><?php for($i=0;$i<=$row['q_diff'];$i++){ echo $str_str ="<img src='./images/Etoile-icon.png' alt='难度系数'>";}?></td>
                                            <td><?php echo $row['t_name']?></td>
                                            <td><?php switch($row['q_type']){case 1:echo "单选题";break;case 2: echo "多选题";break;case 3:echo 判断题;break;default:echo "暂无";}?></td>
                                            <td><?php echo $row['q_score']?></td>
                                            <td><a href="?do=addquestion&qid=<?php echo $row['q_id'];?>">编辑</a></td>
                                    </tr>
                                    <?php
                                            }
                                    ?>
                            </tbody>
                    </table>
            </td></tr>
    <tr><td>
    <div class="submenu_b">
            <ul>
                <li><input type="button" name="selectAll" id="allselect" value="全选"/></li>
		<li><input type="button" name="nonesSelect" id="noneselect" value="全不选"/></li>
        <li><input type="button" name="elseSelect" id="elseselect" value="反选"/></li>
		<li><input type="submit" name="submit" id="delete" value="删除" /></li>
            </ul>
    </div>
    </td>
    </tr>
</table>
</form>
